<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>有奖竞答 - 社交圈</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    body {
      background-color: #f5f5f7;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      color: #1d1d1f;
    }
    
    /* 顶部导航 */
    .top-nav {
      background-color: white;
      padding: 12px 15px;
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #eee;
    }
    
    .nav-title {
      font-size: 18px;
      font-weight: 600;
      margin: 0;
    }
    
    .nav-btn {
      color: #1d1d1f;
      font-size: 20px;
    }
    
    /* 筛选栏 */
    .filter-bar {
      background-color: white;
      padding: 10px 15px;
      display: flex;
      overflow-x: auto;
      gap: 12px;
      border-bottom: 1px solid #eee;
    }
    
    .filter-item {
      white-space: nowrap;
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 14px;
      background-color: #f0f0f0;
      color: #666;
      cursor: pointer;
    }
    
    .filter-item.active {
      background-color: #007aff;
      color: white;
    }
    
    /* 竞答列表容器 */
    .quiz-list {
      padding: 10px;
    }
    
    /* 竞答卡片 */
    .quiz-card {
      background-color: white;
      border-radius: 12px;
      margin-bottom: 12px;
      overflow: hidden;
      box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* 竞答头部 */
    .quiz-header {
      padding: 15px 15px 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .quiz-creator {
      display: flex;
      align-items: center;
    }
    
    .creator-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      object-fit: cover;
      margin-right: 10px;
    }
    
    .creator-name {
      font-weight: 600;
      font-size: 15px;
    }
    
    .quiz-time {
      font-size: 12px;
      color: #8e8e93;
    }
    
    /* 竞答内容 */
    .quiz-content {
      padding: 0 15px 10px;
    }
    
    .quiz-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 8px;
      line-height: 1.4;
    }
    
    .quiz-description {
      font-size: 14px;
      color: #666;
      line-height: 1.5;
      margin-bottom: 12px;
    }
    
    /* 图片容器 */
    .quiz-media {
      width: 100%;
      margin: 0 0 12px;
      border-radius: 8px;
      overflow: hidden;
    }
    
    .quiz-media.single-image img {
      width: 100%;
      height: auto;
      display: block;
    }
    
    .quiz-media.multi-image {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 2px;
    }
    
    .quiz-media.multi-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      aspect-ratio: 1/1;
    }
    
    /* 奖励信息 */
    .reward-info {
      display: flex;
      align-items: center;
      padding: 8px 15px;
      background-color: #fff8e6;
      border-left: 3px solid #ffcc00;
      margin: 0 15px 12px;
      border-radius: 0 4px 4px 0;
    }
    
    .reward-icon {
      color: #ff9500;
      font-size: 18px;
      margin-right: 8px;
    }
    
    .reward-text {
      font-size: 14px;
      font-weight: 600;
      color: #e67e22;
    }
    
    /* 竞答状态 */
    .quiz-status {
      padding: 0 15px 10px;
      display: flex;
      justify-content: space-between;
      font-size: 13px;
      color: #8e8e93;
    }
    
    .status-item {
      display: flex;
      align-items: center;
    }
    
    .status-item i {
      margin-right: 5px;
      font-size: 14px;
    }
    
    /* 底部操作栏 */
    .quiz-actions {
      padding: 10px 15px;
      display: flex;
      justify-content: space-between;
      border-top: 1px solid #eee;
      margin: 0 15px;
    }
    
    .action-btn {
      display: flex;
      align-items: center;
      font-size: 15px;
      padding: 5px 12px;
      border-radius: 20px;
      font-weight: 500;
    }
    
    .action-btn.primary {
      background-color: #007aff;
      color: white;
      border: none;
    }
    
    .action-btn.secondary {
      background-color: #f0f0f0;
      color: #666;
      border: none;
    }
    
    .action-btn i {
      margin-right: 6px;
    }
    
    /* 无图样式特殊处理 */
    .quiz-card.no-image .quiz-content {
      padding-bottom: 15px;
    }
    
    .quiz-card.no-image .quiz-actions {
      margin-top: 0;
    }
    
    /* 加载更多 */
    .load-more {
      text-align: center;
      padding: 15px;
    }
    
    .load-more-btn {
      background-color: white;
      border: 1px solid #eee;
      border-radius: 20px;
      padding: 8px 20px;
      font-size: 14px;
      color: #666;
    }
    
    .load-more-btn.loading {
      color: #ccc;
    }
    
    /* 空状态 */
    .empty-state {
      padding: 40px 20px;
      text-align: center;
      color: #8e8e93;
    }
    
    .empty-state i {
      font-size: 50px;
      margin-bottom: 15px;
      opacity: 0.5;
    }
    
    .empty-state p {
      font-size: 15px;
      margin-bottom: 20px;
    }
  </style>
</head>
<body>
  <!-- 顶部导航 -->
  <div class="top-nav">
    <button class="btn btn-link p-0 nav-btn" onclick="history.back()">
      <i class="fa fa-arrow-left"></i>
    </button>
    <h1 class="nav-title">有奖竞答</h1>
    <button class="btn btn-link p-0 nav-btn">
      <i class="fa fa-plus"></i>
    </button>
  </div>
  
  <!-- 筛选栏 -->
  <div class="filter-bar">
    <div class="filter-item active">全部</div>
    <div class="filter-item">现金奖励</div>
    <div class="filter-item">实物奖品</div>
    <div class="filter-item">优惠券</div>
    <div class="filter-item">进行中</div>
    <div class="filter-item">即将结束</div>
  </div>
  
  <!-- 竞答列表 -->
  <div class="quiz-list">
    <!-- 多图竞答 -->
    <div class="quiz-card">
      <div class="quiz-header">
        <div class="quiz-creator">
          <img src="https://picsum.photos/100/100?random=1" alt="发起者头像" class="creator-avatar">
          <div>
            <div class="creator-name">知识竞赛官方</div>
            <div class="quiz-time">2小时前</div>
          </div>
        </div>
      </div>
      
      <div class="quiz-content">
        <div class="quiz-title">猜一猜这三张图片分别是哪个国家的标志性建筑？</div>
        <div class="quiz-description">
          仔细观察图片中的建筑特征，回答出每个建筑所属的国家，全部答对即可参与抽奖，有机会获得精美旅行套装！
        </div>
        
        <div class="quiz-media multi-image">
          <img src="https://picsum.photos/300/300?random=10" alt="竞答图片1">
          <img src="https://picsum.photos/300/300?random=11" alt="竞答图片2">
          <img src="https://picsum.photos/300/300?random=12" alt="竞答图片3">
        </div>
        
        <div class="reward-info">
          <i class="fa fa-gift reward-icon"></i>
          <div class="reward-text">奖励：旅行套装 × 10份</div>
        </div>
        
        <div class="quiz-status">
          <div class="status-item">
            <i class="fa fa-user"></i>
            <span>1,258人参与</span>
          </div>
          <div class="status-item">
            <i class="fa fa-clock-o"></i>
            <span>剩余12小时</span>
          </div>
        </div>
      </div>
      
      <div class="quiz-actions">
        <button class="action-btn secondary">
          <i class="fa fa-share-alt"></i>
          <span>分享</span>
        </button>
        <button class="action-btn primary">
          <i class="fa fa-pencil"></i>
          <span>立即参与</span>
        </button>
      </div>
    </div>
    
    <!-- 单图竞答 -->
    <div class="quiz-card">
      <div class="quiz-header">
        <div class="quiz-creator">
          <img src="https://picsum.photos/100/100?random=2" alt="发起者头像" class="creator-avatar">
          <div>
            <div class="creator-name">美食达人</div>
            <div class="quiz-time">5小时前</div>
          </div>
        </div>
      </div>
      
      <div class="quiz-content">
        <div class="quiz-title">这道菜的主要食材是什么？</div>
        <div class="quiz-description">
          这是一道经典的地方特色菜，猜一猜它的主要食材是什么？答对者有机会获得50元餐饮代金券！
        </div>
        
        <div class="quiz-media single-image">
          <img src="https://picsum.photos/600/400?random=20" alt="竞答图片">
        </div>
        
        <div class="reward-info">
          <i class="fa fa-ticket reward-icon"></i>
          <div class="reward-text">奖励：50元餐饮代金券 × 50份</div>
        </div>
        
        <div class="quiz-status">
          <div class="status-item">
            <i class="fa fa-user"></i>
            <span>3,742人参与</span>
          </div>
          <div class="status-item">
            <i class="fa fa-clock-o"></i>
            <span>剩余3天</span>
          </div>
        </div>
      </div>
      
      <div class="quiz-actions">
        <button class="action-btn secondary">
          <i class="fa fa-share-alt"></i>
          <span>分享</span>
        </button>
        <button class="action-btn primary">
          <i class="fa fa-pencil"></i>
          <span>立即参与</span>
        </button>
      </div>
    </div>
    
    <!-- 无图竞答 -->
    <div class="quiz-card no-image">
      <div class="quiz-header">
        <div class="quiz-creator">
          <img src="https://picsum.photos/100/100?random=3" alt="发起者头像" class="creator-avatar">
          <div>
            <div class="creator-name">科学小知识</div>
            <div class="quiz-time">昨天 18:30</div>
          </div>
        </div>
      </div>
      
      <div class="quiz-content">
        <div class="quiz-title">下列哪种行星不属于类地行星？</div>
        <div class="quiz-description">
          太阳系中有多颗行星，其中类地行星具有相似的结构特征。请从以下选项中选出不属于类地行星的选项：
          <br>
          A. 水星 &nbsp;&nbsp; B. 金星 &nbsp;&nbsp; C. 火星 &nbsp;&nbsp; D. 木星
        </div>
        
        <div class="reward-info">
          <i class="fa fa-money reward-icon"></i>
          <div class="reward-text">奖励：现金红包 1-100元随机</div>
        </div>
        
        <div class="quiz-status">
          <div class="status-item">
            <i class="fa fa-user"></i>
            <span>5,219人参与</span>
          </div>
          <div class="status-item">
            <i class="fa fa-clock-o"></i>
            <span>剩余1天</span>
          </div>
        </div>
      </div>
      
      <div class="quiz-actions">
        <button class="action-btn secondary">
          <i class="fa fa-share-alt"></i>
          <span>分享</span>
        </button>
        <button class="action-btn primary">
          <i class="fa fa-pencil"></i>
          <span>立即参与</span>
        </button>
      </div>
    </div>
    
    <!-- 多图竞答 -->
    <div class="quiz-card">
      <div class="quiz-header">
        <div class="quiz-creator">
          <img src="https://picsum.photos/100/100?random=4" alt="发起者头像" class="creator-avatar">
          <div>
            <div class="creator-name">电影爱好者</div>
            <div class="quiz-time">昨天 10:15</div>
          </div>
        </div>
      </div>
      
      <div class="quiz-content">
        <div class="quiz-title">这两张截图来自哪两部电影？</div>
        <div class="quiz-description">
          以下是两部经典电影的截图，说出它们的片名即可参与抽奖，正确回答者有机会获得电影通兑券2张。
        </div>
        
        <div class="quiz-media multi-image">
          <img src="https://picsum.photos/300/300?random=30" alt="竞答图片1">
          <img src="https://picsum.photos/300/300?random=31" alt="竞答图片2">
          <!-- 第三格留空 -->
          <div style="background-color: #f9f9f9;"></div>
        </div>
        
        <div class="reward-info">
          <i class="fa fa-film reward-icon"></i>
          <div class="reward-text">奖励：电影通兑券 × 20份</div>
        </div>
        
        <div class="quiz-status">
          <div class="status-item">
            <i class="fa fa-user"></i>
            <span>2,845人参与</span>
          </div>
          <div class="status-item">
            <i class="fa fa-clock-o"></i>
            <span>剩余2天</span>
          </div>
        </div>
      </div>
      
      <div class="quiz-actions">
        <button class="action-btn secondary">
          <i class="fa fa-share-alt"></i>
          <span>分享</span>
        </button>
        <button class="action-btn primary">
          <i class="fa fa-pencil"></i>
          <span>立即参与</span>
        </button>
      </div>
    </div>
  </div>
  
  <!-- 加载更多 -->
  <div class="load-more">
    <button class="load-more-btn" id="loadMoreBtn">
      <i class="fa fa-refresh"></i> 加载更多
    </button>
  </div>

  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 筛选功能
    document.querySelectorAll('.filter-item').forEach(item => {
      item.addEventListener('click', function() {
        // 移除所有active类
        document.querySelectorAll('.filter-item').forEach(i => {
          i.classList.remove('active');
        });
        // 给当前点击项添加active类
        this.classList.add('active');
        
        // 模拟筛选加载
        const quizList = document.querySelector('.quiz-list');
        quizList.style.opacity = '0.5';
        
        setTimeout(() => {
          quizList.style.opacity = '1';
          // 实际应用中这里会根据筛选条件加载不同的竞答内容
        }, 500);
      });
    });
    
    // 立即参与按钮
    document.querySelectorAll('.action-btn.primary').forEach(btn => {
      btn.addEventListener('click', function() {
        const quizTitle = this.closest('.quiz-card').querySelector('.quiz-title').textContent;
        alert(`即将参与：${quizTitle}\n(实际应用中这里会跳转到答题页面)`);
      });
    });
    
    // 分享按钮
    document.querySelectorAll('.action-btn.secondary').forEach(btn => {
      btn.addEventListener('click', function() {
        alert('分享到：微信好友、朋友圈、微博、QQ好友');
      });
    });
    
    // 新建竞答按钮
    document.querySelector('.top-nav .fa-plus').parentElement.addEventListener('click', function() {
      alert('创建新的有奖竞答');
    });
    
    // 加载更多功能
    document.getElementById('loadMoreBtn').addEventListener('click', function() {
      const btn = this;
      btn.classList.add('loading');
      btn.innerHTML = '<i class="fa fa-spinner fa-spin"></i> 加载中...';
      
      // 模拟加载延迟
      setTimeout(() => {
        const quizList = document.querySelector('.quiz-list');
        
        // 随机添加一个新的竞答卡片
        const randomType = Math.floor(Math.random() * 3);
        let newQuiz;
        
        if (randomType === 0) {
          // 多图类型
          newQuiz = `
            <div class="quiz-card">
              <div class="quiz-header">
                <div class="quiz-creator">
                  <img src="https://picsum.photos/100/100?random=${Math.random()*100}" alt="发起者头像" class="creator-avatar">
                  <div>
                    <div class="creator-name">旅行爱好者</div>
                    <div class="quiz-time">3小时前</div>
                  </div>
                </div>
              </div>
              
              <div class="quiz-content">
                <div class="quiz-title">这些风景照片拍摄于哪个国家？</div>
                <div class="quiz-description">
                  这组照片展示了某个国家的自然风光，猜出正确国家即可参与抽奖，有机会获得精美纪念品。
                </div>
                
                <div class="quiz-media multi-image">
                  <img src="https://picsum.photos/300/300?random=${Math.random()*100}" alt="竞答图片1">
                  <img src="https://picsum.photos/300/300?random=${Math.random()*100}" alt="竞答图片2">
                  <img src="https://picsum.photos/300/300?random=${Math.random()*100}" alt="竞答图片3">
                </div>
                
                <div class="reward-info">
                  <i class="fa fa-gift reward-icon"></i>
                  <div class="reward-text">奖励：精美纪念品 × 30份</div>
                </div>
                
                <div class="quiz-status">
                  <div class="status-item">
                    <i class="fa fa-user"></i>
                    <span>${Math.floor(Math.random()*5000)+1000}人参与</span>
                  </div>
                  <div class="status-item">
                    <i class="fa fa-clock-o"></i>
                    <span>剩余${Math.floor(Math.random()*5)+1}天</span>
                  </div>
                </div>
              </div>
              
              <div class="quiz-actions">
                <button class="action-btn secondary">
                  <i class="fa fa-share-alt"></i>
                  <span>分享</span>
                </button>
                <button class="action-btn primary">
                  <i class="fa fa-pencil"></i>
                  <span>立即参与</span>
                </button>
              </div>
            </div>
          `;
        } else if (randomType === 1) {
          // 单图类型
          newQuiz = `
            <div class="quiz-card">
              <div class="quiz-header">
                <div class="quiz-creator">
                  <img src="https://picsum.photos/100/100?random=${Math.random()*100}" alt="发起者头像" class="creator-avatar">
                  <div>
                    <div class="creator-name">音乐达人</div>
                    <div class="quiz-time">6小时前</div>
                  </div>
                </div>
              </div>
              
              <div class="quiz-content">
                <div class="quiz-title">这位歌手的名字是什么？</div>
                <div class="quiz-description">
                  图中是一位著名歌手的演出照，猜出他/她的名字即可参与抽奖，有机会获得最新专辑一张。
                </div>
                
                <div class="quiz-media single-image">
                  <img src="https://picsum.photos/600/400?random=${Math.random()*100}" alt="竞答图片">
                </div>
                
                <div class="reward-info">
                  <i class="fa fa-music reward-icon"></i>
                  <div class="reward-text">奖励：最新专辑 × 15份</div>
                </div>
                
                <div class="quiz-status">
                  <div class="status-item">
                    <i class="fa fa-user"></i>
                    <span>${Math.floor(Math.random()*5000)+1000}人参与</span>
                  </div>
                  <div class="status-item">
                    <i class="fa fa-clock-o"></i>
                    <span>剩余${Math.floor(Math.random()*5)+1}天</span>
                  </div>
                </div>
              </div>
              
              <div class="quiz-actions">
                <button class="action-btn secondary">
                  <i class="fa fa-share-alt"></i>
                  <span>分享</span>
                </button>
                <button class="action-btn primary">
                  <i class="fa fa-pencil"></i>
                  <span>立即参与</span>
                </button>
              </div>
            </div>
          `;
        } else {
          // 无图类型
          newQuiz = `
            <div class="quiz-card no-image">
              <div class="quiz-header">
                <div class="quiz-creator">
                  <img src="https://picsum.photos/100/100?random=${Math.random()*100}" alt="发起者头像" class="creator-avatar">
                  <div>
                    <div class="creator-name">历史小课堂</div>
                    <div class="quiz-time">昨天 09:45</div>
                  </div>
                </div>
              </div>
              
              <div class="quiz-content">
                <div class="quiz-title">中国历史上哪个朝代持续时间最长？</div>
                <div class="quiz-description">
                  中国有着悠久的历史，经历了多个朝代的更替。请从以下选项中选出持续时间最长的朝代：
                  <br>
                  A. 汉朝 &nbsp;&nbsp; B. 唐朝 &nbsp;&nbsp; C. 明朝 &nbsp;&nbsp; D. 清朝
                </div>
                
                <div class="reward-info">
                  <i class="fa fa-book reward-icon"></i>
                  <div class="reward-text">奖励：历史百科全书 × 5份</div>
                </div>
                
                <div class="quiz-status">
                  <div class="status-item">
                    <i class="fa fa-user"></i>
                    <span>${Math.floor(Math.random()*5000)+1000}人参与</span>
                  </div>
                  <div class="status-item">
                    <i class="fa fa-clock-o"></i>
                    <span>剩余${Math.floor(Math.random()*5)+1}天</span>
                  </div>
                </div>
              </div>
              
              <div class="quiz-actions">
                <button class="action-btn secondary">
                  <i class="fa fa-share-alt"></i>
                  <span>分享</span>
                </button>
                <button class="action-btn primary">
                  <i class="fa fa-pencil"></i>
                  <span>立即参与</span>
                </button>
              </div>
            </div>
          `;
        }
        
        // 添加到列表
        quizList.insertAdjacentHTML('beforeend', newQuiz);
        
        // 恢复按钮状态
        btn.classList.remove('loading');
        btn.innerHTML = '<i class="fa fa-refresh"></i> 加载更多';
        
        // 为新添加的按钮绑定事件
        bindNewQuizEvents();
      }, 1500);
    });
    
    // 为新添加的竞答卡片绑定事件
    function bindNewQuizEvents() {
      // 立即参与按钮
      const lastPrimaryBtn = document.querySelectorAll('.action-btn.primary:last-of-type')[0];
      lastPrimaryBtn.addEventListener('click', function() {
        const quizTitle = this.closest('.quiz-card').querySelector('.quiz-title').textContent;
        alert(`即将参与：${quizTitle}\n(实际应用中这里会跳转到答题页面)`);
      });
      
      // 分享按钮
      const lastSecondaryBtn = document.querySelectorAll('.action-btn.secondary:last-of-type')[0];
      lastSecondaryBtn.addEventListener('click', function() {
        alert('分享到：微信好友、朋友圈、微博、QQ好友');
      });
    }
  </script>
</body>
</html>
